using System;
using System.Collections.Generic;
using Castle.ActiveRecord;

namespace Old.KenEgozi.Com.Domain.Blog
{
	[ActiveRecord("Blog_Tags")]
	public class Tag : BlogBase<Tag>
	{
		private string _name;
		private string _urlFriendlyName;
		private Tag _parent = null;
		private IList<Post> _posts = new List<Post>();

		[Property]
		public string Name
		{
			get { return _name; }
			set { _name = value; }
		}

		[Property]
		public string UrlFriendlyName
		{
			get { return _urlFriendlyName; }
			set { _urlFriendlyName = value; }
		}

		[BelongsTo("ParentId")]
		public virtual Tag Parent
		{
			get { return _parent; }
			set { _parent = value; }
		}

		[HasAndBelongsToMany(
			Lazy = true,
			Table = "Blog_PostTagging",
			ColumnKey = "TagId",
			ColumnRef = "PostId",
			Access = PropertyAccess.NosetterCamelcaseUnderscore)]
		public virtual IList<Post> Posts
		{
			get { return _posts; }
		}

	}
}
